/**
 * @author maulin
 */
dojo.provide("medryx.widgets._GridPlugins.tests.AutoFilterTest");
dojo.require("doh.runner");
dojo.require("doh.TestCase");
dojo.require("medryx.widgets._GridPlugins.AutoFilter");

(function() {
	var scaffold = {
		setUp:function() {
			medryx.widgets._GridPlugins.AutoFilter.prototype.filter = function() {
				console.debug("filter", arguments);
			};
			this.af = new medryx.widgets._GridPlugins.AutoFilter();
		},
		mockColumn1: {
                get:function(inRowIndex) {
                    return "TEST-" + inRowIndex;
                },
                index:1,
                autoFilter:true,
                toString:function() {
                    return "mock-column";
                },
				onHeaderContextMenu:function(e) {
					
				},
				name:"TEST COLUMN"
            }
	}
	
	
	doh.register("medryx.widgets.GridPlugins.tests.AutoFilterTest", [
        new doh.TestCase("testGetTooltip", function() {
           var tt = af.getTooltip(mockColumn1);
		   assertEqual("TEST COLUMN", tt.column);
		   
		   var tt2 = af.getTooltip(mockColumn1);
		   assertTrue(tt === tt2);
		   
            
        }, scaffold),
		 new doh.TestCase("testTooltipValueChanged", function() {
           var tt = af.getTooltip(mockColumn1);
           tt.onValueChanged("NEW VALUE");
            
        }, scaffold),
		new doh.TestCase("testCleanFilterValues", function() {
            var values = ["A", "A", "B", "F", "B", "A", "D"];
			var cleaned = af.cleanFilterValues(values);
			assertEqual(4, cleaned.length);
			assertEqual("A", cleaned[0]);
			assertEqual("B", cleaned[1]);
			assertEqual("D", cleaned[2]);
			assertEqual("F", cleaned[3]);
            
        }, scaffold)
		
    ]);


})();

